package com.macaline.service.impl.perssion;

import com.macaline.bean.Result;
import com.macaline.entity.RolePermission;
import com.macaline.mapper.RolePermissionMapper;
import com.macaline.service.perssion.RolePermissionService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * 角色与权限关联表
 */
@Service
public class RolePermissionServiceImpl implements RolePermissionService {

    @Resource
    RolePermissionMapper rolePermissionMapper;

    @Override
    public Result getPermissionByRoleId(Integer roleId) {
        if(roleId < 0){
            return Result.error("角色ID错误");
        }
        List<RolePermission> list = rolePermissionMapper.getPermissionByRoleId(roleId);
        return Result.success(list);
    }
}
